#ifndef CPOINT_H
#define CPOINT_H

#include <ostream>
#include <deque>

class CPoint2D
{
public:
    CPoint2D();
    CPoint2D(int x, int y);
    CPoint2D(const CPoint2D &pt);

    ~CPoint2D();

    int get(int index) const;

    void setX(const int x) {    m_x = x;    }
    int  getX()  const     {    return m_x; }

    void setY(const int y) {    m_y = y;    }
    int  getY()  const     {    return m_y; }

public:

    static std::deque<CPoint2D> getPointBetweenPoints(int resolution, const CPoint2D &start_point, const CPoint2D &end_point);

    double getEuclideanDistance(const CPoint2D &point) const;
    int    getSquareDistance(const CPoint2D &point)    const;

public:
    friend std::ostream &operator<< (std::ostream &os, const CPoint2D &pt)
    {
        os << "[ " << pt.getX() << ", " << pt.getY() << " ]";
        return os;
    }

    CPoint2D &operator = (const CPoint2D &point)
    {
        this->m_x = point.m_x;
        this->m_y = point.m_y;

        return *this;
    }

    bool operator == (const CPoint2D &point)
    {
        if (getX() == point.getX() && getY() == point.getY())
        {
            return true;
        }

        return false;
    }

    const CPoint2D &operator += (const CPoint2D &point)
    {
        m_x += point.getX();
        m_y += point.getY();

        return *this;
    }

    const CPoint2D &operator -= (const CPoint2D &point)
    {
        m_x -= point.getX();
        m_y -= point.getY();

        return *this;
    }
    

private:

    int m_x;
    int m_y;
};

#endif // CPOINT_H
